package ajaxTestSuite;

import com.thoughtworks.selenium.SeleneseTestCase;

public class MutuallyExclusiveCheckBox extends SeleneseTestCase {
	@Override
	public void setUp() throws Exception {
		setUp("http://www.asp.net/", "*firefox");
		selenium.setSpeed("1000");
	}

	public void testMutuallyExclusiveCheckBox() throws Exception {
		selenium.open("/ajax/ajaxcontroltoolkit/Samples/Default.aspx");
		selenium.waitForPageToLoad("30000");
		selenium.click("id=ctl00_SamplesLinks_ctl23_SamplesLink");
		selenium.waitForPageToLoad("30000");
		//Overview: "selenium.check" function doesn't work properly. Exclusion works only if "selenium.click" method used   
		
		selenium.click("id=ctl00_SampleContent_MustHaveGuestBedroomCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveGuestBedroomCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveGuestBedroomCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveGuestBedroomCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveGuestBedroomCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveGuestBedroomCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustHaveSplitPlanCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveSplitPlanCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveSplitPlanCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveSplitPlanCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveSplitPlanCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveSplitPlanCheckBox"));
		

		selenium.click("id=ctl00_SampleContent_MustHaveCoveredPatioCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveCoveredPatioCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveCoveredPatioCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveCoveredPatioCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveCoveredPatioCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveCoveredPatioCheckBox"));

		selenium.click("id=ctl00_SampleContent_MustHaveGatedCommunityCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveGatedCommunityCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveGatedCommunityCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveGatedCommunityCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveGatedCommunityCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveGatedCommunityCheckBox"));

		selenium.click("id=ctl00_SampleContent_MustHaveGolfCommunityCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveGolfCommunityCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveGolfCommunityCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveGolfCommunityCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveGolfCommunityCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveGolfCommunityCheckBox"));

		selenium.click("id=ctl00_SampleContent_MustHaveCommunityPoolCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveCommunityPoolCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveCommunityPoolCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveCommunityPoolCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveCommunityPoolCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveCommunityPoolCheckBox"));

		selenium.click("id=ctl00_SampleContent_MustHaveSoldOutCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustHaveSoldOutCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveSoldOutCheckBox"));
		
		selenium.click("id=ctl00_SampleContent_MustNotHaveSoldOutCheckBox");
		assertTrue(selenium.isChecked("id=ctl00_SampleContent_MustNotHaveSoldOutCheckBox"));
		assertFalse(selenium.isChecked("id=ctl00_SampleContent_MustHaveSoldOutCheckBox"));
	}
}